const req = require.context("./", true, /\Strategy.json$/);
let pokerMap = {};
const requireAll = (requireContext) =>
    requireContext.keys().map((key) => {
        if(key.indexOf('Hand_Strategies') !== -1){
            return;
        }
        let keyArray = key.split("/");
        let actionKey = keyArray[keyArray.length - 2];
        let strategyKey = keyArray[keyArray.length - 1].substr(
            0,
            keyArray[keyArray.length - 1].lastIndexOf(".json")
        );
        if (!pokerMap[actionKey]) {
            pokerMap[actionKey] = {};
        }
        pokerMap[actionKey][strategyKey] = requireContext(key);
    });
requireAll(req);

export default pokerMap;
